project(lighthttp)
set(CMAKE_BUILD_TYPE Debug)
cmake_minimum_required(VERSION 3.22)
add_subdirectory(lighttcp)
add_subdirectory(libdeflate_1)
add_library(lighthttpserver util.cpp httpserver.cpp)
add_executable(httpserver main.cpp)
add_library(lighthttpclient util.cpp httprequest.cpp)
add_executable(httpclient clientmain.cpp)
find_package(OpenSSL)
if(OPENSSL_FOUND)
add_library(lighthttpsserver util.cpp httpsserver.cpp)
add_executable(httpsserver sslmain.cpp)
add_library(lighthttpsclient util.cpp httpsrequest.cpp)
add_executable(httpsclient sslclientmain.cpp)
target_link_libraries(lighthttpsserver lighttcpsslserver libdeflate_static ${OPENSSL_LIBRARIES})
target_link_libraries(lighthttpsclient lighttcpsslclient libdeflate_static ${OPENSSL_LIBRARIES})
if(WIN32)
target_link_libraries(httpsserver lighthttpsserver Ws2_32)
target_link_libraries(httpsclient lighthttpsclient Ws2_32)
else()
target_link_libraries(httpsserver lighthttpsserver)
target_link_libraries(httpsclient lighthttpsclient)
endif()
endif()
target_link_libraries(lighthttpserver lighttcpserver libdeflate_static)
target_link_libraries(lighthttpclient lighttcpclient libdeflate_static)
if(WIN32)
target_link_libraries(httpserver lighthttpserver Ws2_32)
target_link_libraries(httpclient lighthttpclient Ws2_32)
else()
target_link_libraries(httpserver lighthttpserver)
target_link_libraries(httpclient lighthttpclient)
endif()